package com.baby.mall.product.entity;

import com.baby.common.valid.AddGroup;
import com.baby.common.valid.ListValue;
import com.baby.common.valid.UpdateGroup;
import com.baby.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 品牌
 * 
 * @author qinglongzhai
 * @email qinglongzhai@gmail.com
 * @date 2021-03-15 10:47:09
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须指定品牌id",groups = {UpdateGroup.class})
	@Null(message = "新增不能指定Id",groups = {AddGroup.class})
	@TableId
	@ApiModelProperty("品牌id")
	private Long brandId;
	/**
	 * 品牌名
	 */
	@ApiModelProperty("品牌名")
	@NotBlank(message = "品牌名不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "logo必须是一个URL",groups = {AddGroup.class,UpdateGroup.class})
	@NotBlank(groups = {AddGroup.class})
	@ApiModelProperty("品牌logo地址")
	private String logo;
	/**
	 * 介绍
	 */
	@ApiModelProperty("介绍")
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(vals = {0,1},groups = {AddGroup.class, UpdateStatusGroup.class})
	@ApiModelProperty("显示状态[0-不显示；1-显示]")
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@ApiModelProperty("检索首字母")
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value=0,message = "排序必须大于等于0",groups = {AddGroup.class,UpdateGroup.class})
	@ApiModelProperty("排序")
	private Integer sort;

	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty("创建时间")
	private Date gmtCreate;

	@TableField(fill = FieldFill.INSERT_UPDATE)
	@ApiModelProperty("修改时间")
	private Date gmtModified;

	@TableLogic
	@ApiModelProperty("逻辑删除")
	private Integer deleted;

}
